# app/models/guest.py
from app import db
from datetime import datetime, timedelta

class GuestUser(db.Model):
    __tablename__ = 'guest_users'

    guest_id = db.Column(db.String(36), primary_key=True)
    session_token = db.Column(db.String(64), unique=True, nullable=False)
    created_at = db.Column(db.DateTime, default=datetime.utcnow)
    actServer = db.Column(db.String(36))
    expires_at = db.Column(db.DateTime, default=lambda: datetime.utcnow() + timedelta(days=1))

    memberships = db.relationship('ServerMember', back_populates='guest')

    def __repr__(self):
        return f'<GuestUser {self.guest_id}>'